package com.dawnling.butterknife.base;

import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.dawnling.butterknife.R;

import butterknife.ButterKnife;
import butterknife.Unbinder;

public class ButterknifeFragment extends Fragment {
    private Unbinder unbinder;
    @Override  
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        View view = inflater.inflate(R.layout.layout_fragment, container, false);
        //返回一个Unbinder值（进行解绑），注意这里的this不能使用getActivity()  
        unbinder = ButterKnife.bind(this, view);
        return view;  
    }  
  
    /** 
     * onDestroyView中进行解绑操作 
     */  
    @Override  
    public void onDestroyView() {  
        super.onDestroyView();  
        unbinder.unbind();  
    }  
}